#include "IOPort.h"

IOPort::IOPort(DigitalPort& dport,AnalogPort& aport):
    _dport(dport),
    _aport(aport)
{

}
IOPort::~IOPort()
{

}
DigitalInOut& IOPort::dio(uint8_t id)
{
    switch(id)
    {
        case 0:return _dport.d0();break;
        case 1:return _dport.d1();break;
        case 2:return _dport.d2();break;
        case 3:return _dport.d3();break;
        default:break;
    }
    return _dport.d0();
}
DigitalInOut& IOPort::dio0()
{
   return _dport.d0();
}
DigitalInOut& IOPort::dio1()
{
   return _dport.d1();
}
DigitalInOut& IOPort::dio2()
{
   return _dport.d2();
}
DigitalInOut& IOPort::dio3()
{
   return _dport.d3();
}


PwmOut& IOPort::pwm(uint8_t id)
{
    switch(id)
    {
        case 0:return _dport.pwm0();break;
        case 1:return _dport.pwm1();break;
        case 2:return _dport.pwm2();break;
        case 3:return _dport.pwm3();break;
        default:break;
    }
    return _dport.pwm0();
}
PwmOut& IOPort::pwm0()
{
  return  _dport.pwm0();
}
PwmOut& IOPort::pwm1()
{
  return   _dport.pwm1();
}
PwmOut& IOPort::pwm2()
{
  return   _dport.pwm2();
}
PwmOut& IOPort::pwm3()
{
  return   _dport.pwm3();
}


DigitalInOut& IOPort::aio(uint8_t id)
{
    switch(id)
    {
        case 0:return _aport.d0();break;
        case 1:return _aport.d1();break;
        case 2:return _aport.d2();break;
        case 3:return _aport.d3();break;
        default:break;
    }
    return _aport.d0();
}
DigitalInOut& IOPort::aio0()
{
   return  _aport.d0();
}
DigitalInOut& IOPort::aio1()
{
   return  _aport.d1();
}
DigitalInOut& IOPort::aio2()
{
   return  _aport.d2();
}
DigitalInOut& IOPort::aio3()
{
   return  _aport.d3();
}


AnalogIn& IOPort::ain(uint8_t id)
{
    switch(id)
    {
        case 0:return _aport.a0();break;
        case 1:return _aport.a1();break;
        case 2:return _aport.a2();break;
        case 3:return _aport.a3();break;
        default:break;
    }
    return _aport.a0();
}
AnalogIn& IOPort::ain0()
{
  return   _aport.a0();
}
AnalogIn& IOPort::ain1()
{
  return   _aport.a1();
}
AnalogIn& IOPort::ain2()
{
 return    _aport.a2();
}
AnalogIn& IOPort::ain3()
{
  return   _aport.a3();
}